<#include "../base.ftl"/>
<#macro cssfile>
</#macro>

<#macro scriptfile>
</#macro>

<#macro breadcrumb>
    <ul class="breadcrumb">
     <#include "../crumb.ftl"/>
     <li class="active">船员信息</li>
    </ul>
</#macro>

<#macro title>
广大物流云平台
</#macro>

<#macro jsscript>
jQuery(document).ready(function(){
    jQuery("#gridTable").jqGrid({
        url: '${request.contextPath}/list!list.action',
        editurl: '${request.contextPath}/operator.action',
        datatype:"json",
        mtype:'POST',
        height: 270,
        autowidth: true,
        colNames: [
                    '船员编号',
                    '船员代码',
                    '船员姓名',
                    '职称',
                    '船员证号',
                    '所属船舶',
                    '生日',
                    '籍贯',
                    '状态',
                    '手机',
                    '电话',
                    '地址'
                    ],
        colModel:[
        {
                name : 'crewId',
                jsonmap : 'CREW_ID',
                index : 'CREW_ID',
                hidden:true, 
                editable : false,
                searchoptions : {sopt : [ "eq", "cn"]}
        },{
                name : 'crewCode',
                jsonmap : 'CREW_CODE',
                index : 'CREW_CODE',
                editable : true,
                editrules:{required:true}    
        },{
                name : 'crewName',
                jsonmap : 'CREW_NAME',
                index : 'CREW_NAME',
                editable : true,
                editrules:{required:true}    
        },{
                name : 'crewTitles',
                jsonmap : 'CREW_TITLES',
                index : 'CREW_TITLES',
                editable : true,
                edittype: "select",
                editoptions:{value:"0:船长;1:大副;2:二副;3:三副"},
                editrules:{required:true}
        },{
                name : 'crewLicense',
                jsonmap : 'CREW_LICENSE',
                index : 'CREW_LICENSE',
                editable : true,
                editrules:{required:true}    
        },{
                name : 'shippingId',
                jsonmap : 'SHIPPING_ID',
                index : 'SHIPPING_ID',
                editable : true,
                editrules:{required:true}    
        },{
                name : 'birthday',
                jsonmap : 'BIRTHDAY',
                index : 'BIRTHDAY',
                editable: true,
                editrules:{required:true},
                formatter : 'date',
                formatoptions : {srcformat : 'Y/m/d',newformat : 'Y-m-d'},
                editoptions :  {dataInit: function(element) {
                     $(element).datepicker({changeMonth : true,changeYear : true,dateFormat : 'yy-mm-dd'});
                }}
        },{
                name : 'hometown',
                jsonmap : 'HOMETOWN',
                index : 'HOMETOWN',
                editable : true,
                searchoptions : {sopt : [ "eq", "cn"]}    
        },{
                name: 'status', 
                jsonmap: 'STATUS', 
                index:'STATUS', 
                editable: false,
                hidden:true,
                searchoptions : {sopt : [ "eq", "cn"]}
        },{
                name : 'mobilephone',
                jsonmap : 'MOBILEPHONE',
                index : 'MOBILEPHONE',
                editable : true,
                searchoptions : {sopt : [ "eq", "cn"]}    
        },{
                name : 'phone',
                jsonmap : 'PHONE',
                index : 'PHONE',
                editable : true,
                searchoptions : {sopt : [ "eq", "cn"]}    
        },{
                name : 'address',
                jsonmap : 'ADDRESS',
                index : 'ADDRESS',
                editable : true,
                searchoptions : {sopt : [ "eq", "cn"]}
        }],
            sortname: 'CREW_ID',
            sortorder: 'desc',
            viewrecords: true,
            gridview: true,
            rownumbers : true,
            rowNum: 20,
            rowList: [10,20,30],
            pager : "#gridPager",
            jsonReader : {
                //固化定义
                page : "page.pageNo",
                total : "page.totalPages",
                records : "page.totalCount",
                root : "page.result",
                repeatitems : false,
                //设置主Key
                id : 'CREW_ID'
                },
            prmNames:{
                    rows:"page.pageSize",
                    page:"page.pageNo",
                    sort:"page.orderBy",
                    order:"page.order"},
            pager: "#gridPager",
            loadBeforeSend : function(xhr,settings) {
                //设定访问的list标签
                settings.data = settings.data + "&gridKey=/list#TsmCrew";
                return true;
            },
            pager : "#gridPager",
            caption : "船员列表"
            }).navGrid('#gridPager', {
             edit: true,
             add: true,
             del: true,
             search: true
        }, {
            //edit
            beforeShowForm: function(form) {},
            reloadAfterSubmit : true,
            closeAfterEdit : true, //修改完毕后关闭
            afterComplete : opertaionPrompt,
            //设定beanName
            onclickSubmit :setBeanName
        }, {
            //add
            beforeShowForm: function(form) {},
            reloadAfterSubmit : true,
            closeAfterAdd : true, //新增完毕后关闭
            afterComplete : opertaionPrompt,
            //设定beanName
            onclickSubmit :setBeanName,
            //提交前进行验证
            beforeSubmit :validateSumbit 
        }, {
            //del
            //设定beanName
            onclickSubmit :setBeanName,
            reloadAfterSubmit : true,
            afterComplete : opertaionPrompt
        }, {
            //组合查询
            multipleSearch : true
        });
    
        function setBeanName(){
            var add_data = new Object();
            add_data["beanName"] = "tsm.TsmCrew";
            return add_data;
        }
        
        //提交前的验证，检验数据，并加入beanName
        function validateSumbit(postdata, formid){
            return [true,''];
        }
});
</#macro>

<#macro main>
     <table id="gridTable"></table>
     <div id="gridPager"></div>
</#macro>